    //
//  FirstVC.m
//  DogLocate
//
//  Created by mac on 11-5-23.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "FirstVC.h"
#import <QuartzCore/QuartzCore.h>


@implementation FirstVC

-(id)initWithDate:(NSString *)date 
			   city:(NSString *)city 
		   distance:(NSString *)distance 
			   time:(NSString *)time 
			  speed:(NSString *)speed {

	if (self = [super init]) {
		self.view.backgroundColor = [UIColor blackColor];
		
		UIView *v1 = [[UIView alloc]initWithFrame:CGRectMake(10, 15, 300, 140)];
		v1.backgroundColor = [UIColor colorWithRed:0.14 green:0.14 blue:0.14 alpha:1.0f];
		v1.layer.cornerRadius = 8;
		
		UILabel *walkTitile = [[UILabel alloc]initWithFrame:CGRectMake(100, 13, 200, 40)];
		walkTitile.text = [NSString stringWithFormat:@"Walk %@",[date substringToIndex:10]];
		walkTitile.textColor = [UIColor whiteColor];
		walkTitile.font = [UIFont fontWithName:@"Arial-BoldMT" size:22];
		walkTitile.backgroundColor = [UIColor clearColor];
		[v1 addSubview:walkTitile];
		[walkTitile release];
		
		UILabel *walkCity = [[UILabel alloc]initWithFrame:CGRectMake(100, 33, 200, 50)];
		walkCity.text = [NSString stringWithFormat:@"%@",city];
		walkCity.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0f];
		walkCity.font = [UIFont systemFontOfSize:15];
		walkCity.backgroundColor = [UIColor clearColor];
		[v1 addSubview:walkCity];
		[walkCity release];
		
		UILabel *walkDate = [[UILabel alloc]initWithFrame:CGRectMake(100, 73, 200, 50)];
		walkDate.text = [NSString stringWithFormat:@"%@",[date substringToIndex:19]];
		walkDate.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0f];
		walkDate.font = [UIFont systemFontOfSize:20];
		walkDate.backgroundColor = [UIColor clearColor];
		[v1 addSubview:walkDate];
		[walkDate release];
		
		UIImageView *v = [[UIImageView alloc]initWithFrame:CGRectMake(20, 30, 60, 60)];
		v.image = [UIImage imageNamed:@"map.png"];
		[v1 addSubview:v];
		[v release];
		
		[self.view addSubview:v1];
		[v1 release];
		
		UIView *v2 = [[UIView alloc]initWithFrame:CGRectMake(10, 160, 300, 180)];
		v2.backgroundColor = [UIColor colorWithRed:0.14 green:0.14 blue:0.14 alpha:1.0f];
		v2.layer.cornerRadius = 8;
		
		UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(60, 15, 100, 30)];
		label.text = @"距离";
		label.backgroundColor = [UIColor clearColor];
		label.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0f];
		[v2 addSubview:label];
		[label release];
		
		UILabel *walkDistance = [[UILabel alloc]initWithFrame:CGRectMake(60, 50, 200, 50)];
		walkDistance.text = [NSString stringWithFormat:@"%@",distance];
		walkDistance.textColor = [UIColor whiteColor];
		walkDistance.font = [UIFont systemFontOfSize:20];
		walkDistance.backgroundColor = [UIColor clearColor];
		[v2 addSubview:walkDistance];
		[walkDistance release];
		
		label = [[UILabel alloc]initWithFrame:CGRectMake(160, 15, 100, 30)];
		label.text = @"行走时间";
		label.backgroundColor = [UIColor clearColor];
		label.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0f];
		[v2 addSubview:label];
		[label release];
		
		int count = [time intValue];
		int seconds = (int)count % 60;
		int minutes = ((int)count / 60) % 60;
		int hours = (int)count / 3600;
		
		UILabel *walkTime = [[UILabel alloc]initWithFrame:CGRectMake(160, 50, 200, 50)];
		walkTime.text = [NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes,seconds];
		walkTime.textColor = [UIColor whiteColor];
		walkTime.font = [UIFont systemFontOfSize:20];
		walkTime.backgroundColor = [UIColor clearColor];
		[v2 addSubview:walkTime];
		[walkTime release];
		
		label = [[UILabel alloc]initWithFrame:CGRectMake(60, 100, 150, 30)];
		label.text = @"平均速度";
		label.backgroundColor = [UIColor clearColor];
		label.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0f];
		[v2 addSubview:label];
		[label release];
		
		UILabel *walkSpeed = [[UILabel alloc]initWithFrame:CGRectMake(60, 130, 200, 50)];
		walkSpeed.text = [NSString stringWithFormat:@"%@",speed];
		walkSpeed.textColor = [UIColor whiteColor];
		walkSpeed.font = [UIFont systemFontOfSize:20];
		walkSpeed.backgroundColor = [UIColor clearColor];
		[v2 addSubview:walkSpeed];
		[walkSpeed release];
		
		
		[self.view addSubview:v2];
		[v2 release];
		
		
		
	}
	return self;
}

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
